package cn.kgc.shiro;

import org.apache.shiro.crypto.hash.Md5Hash;

/**
 * @author: mosin
 * @version: v1.0  2023/1/9
 * shiro中的加密操作
 */
public class TestMD5 {


    public static void main(String[] args) {

        String password="12345";

        Md5Hash md5Hash = new Md5Hash(password);
        String s = md5Hash.toHex();  //  获取加密的结果  827ccb0eea8a706c4c34a16891f84e7b
        System.out.println("12345 MD5 result = " + s);  //

        // 密码加盐处理 salt  dc4b56ff4967374b261a29cd4a90580d
        Md5Hash md5Hash1 = new Md5Hash(password, "hello");
        String s1 = md5Hash1.toHex();
        System.out.println("12345 MD5+slat result = " + s1);

        //提升hash的次数  daf143a91c6318a2c637a52824e431ab
        Md5Hash md5Hash2 = new Md5Hash(password, "hello", 5);
        String s2 = md5Hash2.toHex();
        System.out.println("12345 MD5+slat+hashIterations result = " + s2);

    }
}



